<template>
  <div class="app-container">
    

    <el-card class="box-card mt">
      
      <el-table
          v-loading="listLoading"
          :data="list"
          border
          fit
          highlight-current-row
          style="width: 100%; margin-top: 10px"
        >
          <el-table-column
            :show-overflow-tooltip="true"
            prop="data"
            label="数据"
           />
        

         
          <el-table-column
            :show-overflow-tooltip="true"
            prop="createdTime"
            label="创建时间"
            width="160"
          />
         
          <el-table-column align="center" label width="180">
            <template  #default="scope">
              <el-button type="danger" @click="onDelete(scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>

      
      </el-card>
  
   
  </div>
</template>

<script>
import { getAll, deletes } from "@/api/admin/datalog";
import { ElMessage, ElMessageBox } from 'element-plus'

export default {
  name: "datalog",
  components: {  },
  data() {
    return {

      list: null,
      
      listLoading: true,
     
    };
  },
  computed: {},
  created() {
    this.getList();
  },
  methods: {
    getList() {
      this.listLoading = true;
      getAll().then((res) => {
        this.list = res.result;
        this.listLoading = false;
      });
    },
   
    onDelete(row) {
      let _this = this
      ElMessageBox.confirm("确认删除？")
        .then((_) => {
          deletes(row.id).then((_) => {
            _this.getList();
      });
        })
        .catch((_) => {});
    },

  },
  mounted: function () {},
};
</script>


